
/**
 * 根据距离计算运费
 * 参数含义依次为：车型，距离(km)，数量(一方)
 */
export function calcuFres(carType,dis,sum) {
  if (carType == "大车（13-15方）") {
    let carriage = 0;
    if (dis <= 5 && dis > 0) {
      carriage = 8.8*sum;
    }
    if (dis <= 15 && dis > 5) {
      carriage = 8.8*sum + (dis - 5) * 1.32*sum;
    }
    if (dis <= 25 && dis > 15) {
      carriage = 8.8*sum + 13.2*sum + (dis - 15) * 0.7*sum;
    }
    if (dis > 25) {
      carriage = 8.8*sum + 13.2*sum + 7*sum + (dis - 25) * 0.53*sum;
    }
    return carriage.toFixed(2);
  } else if (carType == "小车（6-10方）") {
    let carriage = 0;
    if (dis <= 5 && dis > 0) {
      carriage = 10*sum;
    }
    if (dis <= 15 && dis > 5) {
      carriage = 10*sum + (dis - 5) * 1.5*sum;
    }
    if (dis <= 25 && dis > 15) {
      carriage = 10*sum + 15*sum + (dis - 15) * 0.8*sum;
    }
    if (dis > 25) {
      carriage = 10*sum + 15*sum + 8*sum + (dis - 25) * 0.6*sum;
    }
    return carriage.toFixed(2);
  }
}